
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>RN分包机制 · 👨🏽‍💻前端漫游指南</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="WuXiaolong">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="./" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                        <b>1.1.</b>
                    
                    介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../Base/">
            
                <a href="../Base/">
            
                    
                        <b>1.2.</b>
                    
                    前端基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../Base/">
            
                <a href="../Base/">
            
                    
                        <b>1.2.1.</b>
                    
                    原生js系列
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../Base/手写call1.html">
            
                <a href="../Base/手写call1.html">
            
                    
                        <b>1.2.1.1.</b>
                    
                    类型转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../Base/EventLoop.html">
            
                <a href="../Base/EventLoop.html">
            
                    
                        <b>1.2.1.2.</b>
                    
                    EventLoop
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../Base/CSS.html">
            
                <a href="../Base/CSS.html">
            
                    
                        <b>1.2.2.</b>
                    
                    CSS系列
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../Base/布局系列.html">
            
                <a href="../Base/布局系列.html">
            
                    
                        <b>1.2.2.1.</b>
                    
                    布局系列
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../Design/">
            
                <a href="../Design/">
            
                    
                        <b>1.3.</b>
                    
                    前端设计模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../Design/工程模式.html">
            
                <a href="../Design/工程模式.html">
            
                    
                        <b>1.3.1.</b>
                    
                    工厂模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../Design/单一模式.html">
            
                <a href="../Design/单一模式.html">
            
                    
                        <b>1.3.2.</b>
                    
                    单一模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../DiyCode/">
            
                <a href="../DiyCode/">
            
                    
                        <b>1.4.</b>
                    
                    手撕代码
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../DiyCode/手写call.html">
            
                <a href="../DiyCode/手写call.html">
            
                    
                        <b>1.4.1.</b>
                    
                    手写call
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../DiyCode/手写bind.html">
            
                <a href="../DiyCode/手写bind.html">
            
                    
                        <b>1.4.2.</b>
                    
                    手写bind
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../Algorithm/">
            
                <a href="../Algorithm/">
            
                    
                        <b>1.5.</b>
                    
                    前端算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../Algorithm/前端算法.html">
            
                <a href="../Algorithm/前端算法.html">
            
                    
                        <b>1.5.1.</b>
                    
                    前端算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Algorithm/统计算法的执行效率和资源消耗.html">
            
                <a href="../Algorithm/统计算法的执行效率和资源消耗.html">
            
                    
                        <b>1.5.2.</b>
                    
                    统计算法的执行效率和资源消耗
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Algorithm/从Chrome V8源码看JavaScript数组.html">
            
                <a href="../Algorithm/从Chrome V8源码看JavaScript数组.html">
            
                    
                        <b>1.5.3.</b>
                    
                    从Chrome V8源码看JavaScript数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Algorithm/LRU算法.html">
            
                <a href="../Algorithm/LRU算法.html">
            
                    
                        <b>1.5.4.</b>
                    
                    LRU算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Algorithm/链表原来如此简单.html">
            
                <a href="../Algorithm/链表原来如此简单.html">
            
                    
                        <b>1.5.5.</b>
                    
                    链表原来如此简单
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../Vue/">
            
                <a href="../Vue/">
            
                    
                        <b>1.6.</b>
                    
                    Vue知识点
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../Vue/Proxy 基本使用与defineProperty.html">
            
                <a href="../Vue/Proxy 基本使用与defineProperty.html">
            
                    
                        <b>1.6.1.</b>
                    
                    Proxy 基本使用与defineProperty
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../Vue/面试题串讲_vue.html">
            
                <a href="../Vue/面试题串讲_vue.html">
            
                    
                        <b>1.6.2.</b>
                    
                    面试题串讲_vue
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../React/">
            
                <a href="../React/">
            
                    
                        <b>1.7.</b>
                    
                    React知识点
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../React/setState解析.html">
            
                <a href="../React/setState解析.html">
            
                    
                        <b>1.7.1.</b>
                    
                    setState解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../React/Fetch异步中止.html">
            
                <a href="../React/Fetch异步中止.html">
            
                    
                        <b>1.7.2.</b>
                    
                    Fetch异步中止
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../React/面试题串讲_react.html">
            
                <a href="../React/面试题串讲_react.html">
            
                    
                        <b>1.7.3.</b>
                    
                    面试题串讲_react
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="./">
            
                <a href="./">
            
                    
                        <b>1.8.</b>
                    
                    ReactNative
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.8.1" data-path="RN分包机制.html">
            
                <a href="RN分包机制.html">
            
                    
                        <b>1.8.1.</b>
                    
                    RN分包机制
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >RN分包机制</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="react-native&#x62C6;&#x5305;&#x4E4B;-&#x539F;&#x751F;&#x52A0;&#x8F7D;&#x591A;bundle">React native&#x62C6;&#x5305;&#x4E4B; &#x539F;&#x751F;&#x52A0;&#x8F7D;&#x591A;bundle</h1>
<h2 id="&#x4E3A;&#x4EC0;&#x4E48;&#x8981;&#x62C6;&#x5305;&#xFF1F;">&#x4E3A;&#x4EC0;&#x4E48;&#x8981;&#x62C6;&#x5305;&#xFF1F;</h2>
<p><strong>bundle&#x6587;&#x4EF6;&#x8FC7;&#x5927;&#xFF1A;</strong> &#x4E00;&#x4E2A;Helloworld&#x7684;App&#xFF0C;&#x5982;&#x679C;&#x4F7F;&#x7528;0.53RN &#x5B98;&#x65B9;&#x547D;&#x4EE4;react-native bundle&#x6253;&#x5305;&#x51FA;&#x6765;&#x7684;JSBundle&#x6587;&#x4EF6;&#x5927;&#x5C0F;&#x5927;&#x7EA6;&#x4E3A;530KB&#xFF0C;RN&#x4F9D;&#x8D56;&#x6A21;&#x5757;&#x672C;&#x8EAB;&#x5360;&#x4E86;99.9%&#x3002;</p>
<p><strong>&#x9875;&#x9762;&#x52A0;&#x8F7D;&#x6162;&#xFF1A;</strong> &#x5982;&#x679C;&#x4F7F;&#x7528;&#x70ED;&#x66F4;&#x65B0;&#xFF0C;&#x4ECE;&#x7F51;&#x7EDC;&#x83B7;&#x53D6;&#x6574;&#x4E2A;&#x5305;&#x7684;&#x4E0B;&#x8F7D;&#x65F6;&#x95F4;&#x5F88;&#x957F;&#xFF0C;&#x6BCF;&#x6B21;&#x8FDB;&#x5165;RN&#x9875;&#x9762;&#x90FD;&#x9700;&#x8981;&#x6267;&#x884C;RN&#x57FA;&#x7840;&#x6A21;&#x5757;&#x7684;&#x5B9A;&#x4E49;&#x3002;</p>
<p>&#x5982;&#x679C;&#x53EA;&#x662F;&#x4E00;&#x4E2A;&#x5355;&#x72EC;&#x7684;&#x65B0;APP&#xFF0C;&#x7EAF;RN&#x7684;&#xFF0C;&#x6216;&#x8005;&#x53EA;&#x6709;&#x4E00;&#x4E24;&#x4E2A;&#x4E1A;&#x52A1;&#x4F7F;&#x7528;&#xFF0C;&#x8FD9;&#x70B9;&#x5927;&#x5C0F;&#x7B97;&#x4E0D;&#x4E86;&#x4EC0;&#x4E48;&#x3002;
&#x4F46;&#x662F;&#x5BF9;&#x4E8E;&#x5F88;&#x591A;&#x4E1A;&#x52A1;&#x7684;&#x516C;&#x53F8;&#x9879;&#x76EE;&#xFF0C;&#x5982;&#x679C;&#x6BCF;&#x4E2A;&#x4E1A;&#x52A1;&#x7684;JSBundle&#x90FD;&#x9700;&#x8981;&#x8FD9;&#x4E48;&#x5927;&#x7684;&#x4E00;&#x4E2A;RN&#x6846;&#x67B6;&#xFF0C;&#x90A3;&#x5C06;&#x662F;&#x6CA1;&#x5FC5;&#x8981;&#x7684;&#x3002;</p>
<p><strong>Facebook&#x5B98;&#x65B9;&#x6709;&#x6CA1;&#x6709;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#x5462;&#xFF1F;</strong>
Facebook&#x7684;&#x6253;&#x5305;&#x5DE5;&#x5177;&#x662F;metro, metro&#x81EA;&#x5E26;unbundle&#x547D;&#x4EE4;&#xFF0C;&#x4E0D;&#x8FC7;&#xFF0C;&#x6253;&#x5305;&#x7ED3;&#x679C;&#x4E0D;&#x7B26;&#x5408;&#x9884;&#x671F;&#xFF1B;
Android&#x7AEF;&#x662F;&#x5C06;&#x6BCF;&#x4E00;&#x4E2A;&#x6A21;&#x5757;&#x8F93;&#x51FA;&#x5230;&#x5355;&#x4E2A;&#x6587;&#x4EF6;&#x5E76;&#x4EE5;&#x6A21;&#x5757;ID&#x547D;&#x540D;&#xFF1B;IOS&#x7AEF;&#x662F;&#x5C06;&#x6A21;&#x5757;&#x4EE5;&#x6D41;&#x5F62;&#x5F0F;&#x6253;&#x5230;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x4E2D;&#xFF1B;</p>
<h2 id="&#x65B9;&#x6848;">&#x65B9;&#x6848;</h2>
<p>&#x8C03;&#x7814;&#x7684;&#x65B9;&#x6848;&#x53EF;&#x4EE5;&#x5206;&#x4E09;&#x7C7B;&#xFF1A;</p>
<h4 id="1&#x624B;&#x52A8;&#x62C6;&#x5206;&#x5408;&#x5E76;&#x540E;&#x518D;&#x52A0;&#x8F7D;">1.&#x624B;&#x52A8;&#x62C6;&#x5206;&amp;&#x5408;&#x5E76;&#x540E;&#x518D;&#x52A0;&#x8F7D;</h4>
<p>&#x4F7F;&#x7528;RN&#x6253;&#x5305;&#x5DE5;&#x5177;&#x6253;&#x5305;&#xFF0C;&#x624B;&#x52A8;&#x5C06;&#x6587;&#x4EF6;&#x5206;&#x5F00;&#x5206;&#x6210;&#x57FA;&#x7840;&#x5305;A.js, &#x4E1A;&#x52A1;&#x5305;B.js;&#x7136;&#x540E;&#x5728;APP&#x52A0;&#x8F7D;&#x8BE5;&#x9875;&#x9762;&#x7684;&#x65F6;&#x5019;&#x5C06;A,B&#x4E24;&#x4E2A;&#x6587;&#x4EF6;&#x5408;&#x5E76;&#x518D;&#x6267;&#x884C;&#xFF1B;
&#x4F18;&#x70B9;&#xFF1A;&#x6210;&#x672C;&#x4F4E;&#xFF0C;&#x4E0D;&#x9700;&#x8981;&#x6539;&#x6253;&#x5305;&#x5DE5;&#x5177;&#xFF1B;
&#x7F3A;&#x70B9;&#xFF1A;&#x6027;&#x80FD;&#x6CA1;&#x6709;&#x63D0;&#x5347;&#xFF0C;&#x4E0D;&#x80FD;&#x4F18;&#x5316;&#x6267;&#x884C;&#x65F6;&#x95F4;&#xFF0C;&#x53CD;&#x800C;&#x4F1A;&#x589E;&#x52A0;&#xFF1B;</p>
<h4 id="2&#x52A8;&#x6001;&#x66F4;&#x65B0;">2.&#x52A8;&#x6001;&#x66F4;&#x65B0;</h4>
<p>&#x53EF;&#x4EE5;&#x4ECE;&#x7F16;&#x8BD1;&#x4EA7;&#x7269;&#x770B;&#x5230;require(moduleID)&#xFF1B;&#x8FD9;&#x4E2A;&#x65B9;&#x6848;&#x7684;&#x601D;&#x8DEF;&#x662F;&#xFF1A;&#x7F16;&#x5199;&#x4E00;&#x4E2A;&#x7A7A;&#x7684;React&#x5BB9;&#x5668;&#x7EC4;&#x4EF6;&#xFF0C;&#x5229;&#x7528;DeviceEventEmitter&#x76D1;&#x542C;&#x4E00;&#x4E2A;Native&#x4E8B;&#x4EF6;&#xFF0C;&#x5728;&#x9700;&#x8981;&#x52A0;&#x8F7D;&#x9875;&#x9762;&#x65F6;&#xFF0C;Native&#x4E0B;&#x8F7D;&#x5C06;&#x6A21;&#x5757;&#x4FDD;&#x5B58;&#x4E0B;&#x6765;&#xFF0C;&#x4EE5;&#x5BF9;&#x5E94;&#x6A21;&#x5757;ID&#x547D;&#x540D;&#xFF0C;&#x7136;&#x540E;&#x901A;&#x8FC7;DeviceEventEmitter&#x5BF9;&#x5E94;&#x6A21;&#x5757;&#x7684;id&#x53D1;&#x7ED9;React&#x6765;&#x8C03;&#x7528;require(msg.id)</p>
<h2 id="reactnative-&#x6253;&#x5305;&#x547D;&#x4EE4;&#x8BF4;&#x660E;">ReactNative &#x6253;&#x5305;&#x547D;&#x4EE4;&#x8BF4;&#x660E;</h2>
<p>&#x4F7F;&#x7528; react-native bundle --help &#x6765;&#x67E5;&#x770B;&#x6253;&#x5305;&#x7684;&#x5177;&#x4F53;&#x53C2;&#x6570;</p>
<pre class="language-"><code class="lang-js"> react<span class="token operator">-</span>native bundle <span class="token punctuation">[</span>&#x53C2;&#x6570;<span class="token punctuation">]</span>
  &#x6784;&#x5EFA; js &#x79BB;&#x7EBF;&#x5305; 

  Options<span class="token operator">:</span>

    <span class="token operator">-</span>h<span class="token punctuation">,</span> <span class="token operator">--</span>help                   &#x8F93;&#x51FA;&#x5982;&#x4F55;&#x4F7F;&#x7528;&#x7684;&#x4FE1;&#x606F;
    <span class="token operator">--</span>entry<span class="token operator">-</span>file <span class="token operator">&lt;</span>path<span class="token operator">&gt;</span>          <span class="token constant">RN</span>&#x5165;&#x53E3;&#x6587;&#x4EF6;&#x7684;&#x8DEF;&#x5F84;<span class="token punctuation">,</span> &#x7EDD;&#x5BF9;&#x8DEF;&#x5F84;&#x6216;&#x76F8;&#x5BF9;&#x8DEF;&#x5F84;
    <span class="token operator">--</span>platform <span class="token punctuation">[</span>string<span class="token punctuation">]</span>          ios &#x6216; andorid
    <span class="token operator">--</span>transformer <span class="token punctuation">[</span>string<span class="token punctuation">]</span>       Specify a custom transformer to be used
    <span class="token operator">--</span>dev <span class="token punctuation">[</span>boolean<span class="token punctuation">]</span>              &#x5982;&#x679C;&#x4E3A;<span class="token boolean">false</span><span class="token punctuation">,</span> &#x8B66;&#x544A;&#x4F1A;&#x4E0D;&#x663E;&#x793A;&#x5E76;&#x4E14;&#x6253;&#x51FA;&#x7684;&#x5305;&#x7684;&#x5927;&#x5C0F;&#x4F1A;&#x53D8;&#x5C0F;
    <span class="token operator">--</span>prepack                    &#x5F53;&#x901A;&#x8FC7;&#x65F6;<span class="token punctuation">,</span> &#x6253;&#x5305;&#x8F93;&#x51FA;&#x5C06;&#x4F7F;&#x7528;Prepack&#x683C;&#x5F0F;&#x5316;
    <span class="token operator">--</span>bridge<span class="token operator">-</span>config <span class="token punctuation">[</span>string<span class="token punctuation">]</span>     &#x4F7F;&#x7528;Prepack&#x7684;&#x4E00;&#x4E2A;json&#x683C;&#x5F0F;&#x7684;&#x6587;&#x4EF6;__fbBatchedBridgeConfig &#x4F8B;&#x5982;<span class="token operator">:</span> <span class="token punctuation">.</span><span class="token operator">/</span>bridgeconfig<span class="token punctuation">.</span>json
    <span class="token operator">--</span>bundle<span class="token operator">-</span>output <span class="token operator">&lt;</span>string<span class="token operator">&gt;</span>     &#x6253;&#x5305;&#x540E;&#x7684;&#x6587;&#x4EF6;&#x8F93;&#x51FA;&#x76EE;&#x5F55;<span class="token punctuation">,</span> &#x4F8B;<span class="token operator">:</span> <span class="token operator">/</span>tmp<span class="token operator">/</span>groups<span class="token punctuation">.</span>bundle
    <span class="token operator">--</span>bundle<span class="token operator">-</span>encoding <span class="token punctuation">[</span>string<span class="token punctuation">]</span>   &#x6253;&#x79BB;&#x7EBF;&#x5305;&#x7684;&#x683C;&#x5F0F; &#x53EF;&#x53C2;&#x8003;&#x94FE;&#x63A5;https<span class="token operator">:</span><span class="token operator">/</span><span class="token operator">/</span>nodejs<span class="token punctuation">.</span>org<span class="token operator">/</span>api<span class="token operator">/</span>buffer<span class="token punctuation">.</span>html#buffer_buffer<span class="token punctuation">.</span>
    <span class="token operator">--</span>sourcemap<span class="token operator">-</span>output <span class="token punctuation">[</span>string<span class="token punctuation">]</span>  &#x751F;&#x6210;Source Map&#xFF0C;&#x4F46;<span class="token number">0.14</span>&#x4E4B;&#x540E;&#x4E0D;&#x518D;&#x81EA;&#x52A8;&#x751F;&#x6210;source map&#xFF0C;&#x9700;&#x8981;&#x624B;&#x52A8;&#x6307;&#x5B9A;&#x8FD9;&#x4E2A;&#x53C2;&#x6570;&#x3002;&#x4F8B;<span class="token operator">:</span> <span class="token operator">/</span>tmp<span class="token operator">/</span>groups<span class="token punctuation">.</span>map
    <span class="token operator">--</span>assets<span class="token operator">-</span>dest <span class="token punctuation">[</span>string<span class="token punctuation">]</span>       &#x6253;&#x5305;&#x65F6;&#x56FE;&#x7247;&#x8D44;&#x6E90;&#x7684;&#x5B58;&#x50A8;&#x8DEF;&#x5F84;
    <span class="token operator">--</span>verbose                    &#x663E;&#x793A;&#x6253;&#x5305;&#x8FC7;&#x7A0B;
    <span class="token operator">--</span>reset<span class="token operator">-</span>cache                &#x79FB;&#x9664;&#x7F13;&#x5B58;&#x6587;&#x4EF6;
    <span class="token operator">--</span>config <span class="token punctuation">[</span>string<span class="token punctuation">]</span>            &#x547D;&#x4EE4;&#x884C;&#x7684;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;
</code></pre>
<h3 id="reactnative-&#x6253;&#x79BB;&#x7EBF;&#x5305;&#x6D41;&#x7A0B;-&#x4E3E;&#x4F8B;ios">ReactNative &#x6253;&#x79BB;&#x7EBF;&#x5305;&#x6D41;&#x7A0B; (&#x4E3E;&#x4F8B;iOS)</h3>
<p>&#x6267;&#x884C;&#x6253;&#x5305;&#x547D;&#x4EE4;</p>
<pre class="language-"><code class="lang-js">react<span class="token operator">-</span>native bundle <span class="token operator">--</span>entry<span class="token operator">-</span>file index<span class="token punctuation">.</span>ios<span class="token punctuation">.</span>js <span class="token operator">--</span>bundle<span class="token operator">-</span>output <span class="token punctuation">.</span><span class="token operator">/</span>ios<span class="token operator">/</span>bundle<span class="token operator">/</span>index<span class="token punctuation">.</span>ios<span class="token punctuation">.</span>jsbundle <span class="token operator">--</span>platform ios <span class="token operator">--</span>assets<span class="token operator">-</span>dest <span class="token punctuation">.</span><span class="token operator">/</span>ios<span class="token operator">/</span>bundle <span class="token operator">--</span>dev <span class="token boolean">false</span>
</code></pre>
<pre class="language-"><code class="lang-js">Unable to parse cache file<span class="token punctuation">.</span> Will clear and <span class="token keyword">continue</span><span class="token punctuation">.</span>
<span class="token punctuation">[</span><span class="token number">2017</span><span class="token operator">-</span><span class="token number">1</span><span class="token operator">-</span><span class="token number">3</span> <span class="token number">16</span><span class="token operator">:</span><span class="token number">58</span><span class="token operator">:</span><span class="token number">56</span><span class="token punctuation">]</span> <span class="token operator">&lt;</span><span class="token constant">START</span><span class="token operator">&gt;</span> Initializing Packager
<span class="token punctuation">[</span><span class="token number">2017</span><span class="token operator">-</span><span class="token number">1</span><span class="token operator">-</span><span class="token number">3</span> <span class="token number">16</span><span class="token operator">:</span><span class="token number">58</span><span class="token operator">:</span><span class="token number">56</span><span class="token punctuation">]</span> <span class="token operator">&lt;</span><span class="token constant">START</span><span class="token operator">&gt;</span> Building <span class="token keyword">in</span><span class="token operator">-</span>memory fs <span class="token keyword">for</span> JavaScript
<span class="token punctuation">[</span><span class="token number">2017</span><span class="token operator">-</span><span class="token number">1</span><span class="token operator">-</span><span class="token number">3</span> <span class="token number">16</span><span class="token operator">:</span><span class="token number">58</span><span class="token operator">:</span><span class="token number">56</span><span class="token punctuation">]</span> <span class="token operator">&lt;</span><span class="token constant">END</span><span class="token operator">&gt;</span>   Building <span class="token keyword">in</span><span class="token operator">-</span>memory fs <span class="token keyword">for</span> <span class="token function">JavaScript</span> <span class="token punctuation">(</span><span class="token number">74</span>ms<span class="token punctuation">)</span>
<span class="token punctuation">[</span><span class="token number">2017</span><span class="token operator">-</span><span class="token number">1</span><span class="token operator">-</span><span class="token number">3</span> <span class="token number">16</span><span class="token operator">:</span><span class="token number">58</span><span class="token operator">:</span><span class="token number">57</span><span class="token punctuation">]</span> <span class="token operator">&lt;</span><span class="token constant">START</span><span class="token operator">&gt;</span> Building Haste Map
<span class="token punctuation">[</span><span class="token number">2017</span><span class="token operator">-</span><span class="token number">1</span><span class="token operator">-</span><span class="token number">3</span> <span class="token number">16</span><span class="token operator">:</span><span class="token number">58</span><span class="token operator">:</span><span class="token number">57</span><span class="token punctuation">]</span> <span class="token operator">&lt;</span><span class="token constant">END</span><span class="token operator">&gt;</span>   Building Haste <span class="token function">Map</span> <span class="token punctuation">(</span><span class="token number">392</span>ms<span class="token punctuation">)</span>
<span class="token punctuation">[</span><span class="token number">2017</span><span class="token operator">-</span><span class="token number">1</span><span class="token operator">-</span><span class="token number">3</span> <span class="token number">16</span><span class="token operator">:</span><span class="token number">58</span><span class="token operator">:</span><span class="token number">57</span><span class="token punctuation">]</span> <span class="token operator">&lt;</span><span class="token constant">END</span><span class="token operator">&gt;</span>   Initializing <span class="token function">Packager</span> <span class="token punctuation">(</span><span class="token number">498</span>ms<span class="token punctuation">)</span>
<span class="token punctuation">[</span><span class="token number">2017</span><span class="token operator">-</span><span class="token number">1</span><span class="token operator">-</span><span class="token number">3</span> <span class="token number">16</span><span class="token operator">:</span><span class="token number">58</span><span class="token operator">:</span><span class="token number">57</span><span class="token punctuation">]</span> <span class="token operator">&lt;</span><span class="token constant">START</span><span class="token operator">&gt;</span> Transforming files
<span class="token punctuation">[</span><span class="token number">2017</span><span class="token operator">-</span><span class="token number">1</span><span class="token operator">-</span><span class="token number">3</span> <span class="token number">16</span><span class="token operator">:</span><span class="token number">58</span><span class="token operator">:</span><span class="token number">57</span><span class="token punctuation">]</span> <span class="token operator">&lt;</span><span class="token constant">END</span><span class="token operator">&gt;</span>   Transforming <span class="token function">files</span> <span class="token punctuation">(</span><span class="token number">436</span>ms<span class="token punctuation">)</span>
bundle<span class="token operator">:</span> start
bundle<span class="token operator">:</span> finish
bundle<span class="token operator">:</span> Writing bundle output to<span class="token operator">:</span> <span class="token punctuation">.</span><span class="token operator">/</span>ios<span class="token operator">/</span>bundle<span class="token operator">/</span>index<span class="token punctuation">.</span>ios<span class="token punctuation">.</span>jsbundle
bundle<span class="token operator">:</span> Copying <span class="token number">5</span> asset files
bundle<span class="token operator">:</span> Done writing bundle output
bundle<span class="token operator">:</span> Done copying assets
</code></pre>
<p><img src="../Users/lovewcc/Documents/Gitbook/ReactNative/image-20200417141318038.png" alt="image-20200417141318038"></p>
<p>&#x751F;&#x6210;&#x7684;jsbundle&#x57FA;&#x672C;&#x5206;&#x6210;3&#x4E2A;&#x90E8;&#x5206;&#xFF1A;</p>
<ul>
<li>&#x5934;&#x90E8;&#xFF1A;&#x5168;&#x5C40;&#x5B9A;&#x4E49;&#xFF0C;&#x4E3B;&#x8981;&#x662F;define&#xFF0C;require&#x7B49;&#x5168;&#x5C40;&#x6A21;&#x5757;&#x7684;&#x5B9A;&#x4E49;</li>
<li>&#x4E2D;&#x90E8;&#xFF1A;&#x6A21;&#x5757;&#x5B9A;&#x4E49;&#xFF0C;RN&#x6846;&#x67B6;&#x548C;&#x4E1A;&#x52A1;&#x7684;&#x5404;&#x4E2A;&#x6A21;&#x5757;&#x5B9A;&#x4E49;</li>
<li>&#x5C3E;&#x90E8;&#xFF1A;&#x5F15;&#x64CE;&#x521D;&#x59CB;&#x5316;&#x548C;&#x5165;&#x53E3;&#x51FD;&#x6570;&#x6267;&#x884C;</li>
</ul>
<p><img src="../Users/lovewcc/Documents/Gitbook/ReactNative/20200417154717.png" alt=""></p>
<p>__d&#x662F;RN&#x81EA;&#x5B9A;&#x4E49;&#x7684;define&#xFF0C;<strong>d&#x540E;&#x9762;&#x7684;&#x6570;&#x5B57;&#x662F;&#x6A21;&#x5757;&#x7684;id&#xFF0C;&#x662F;&#x5728;RN&#x6253;&#x5305;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x89E3;&#x6790;&#x4F9D;&#x8D56;&#x5173;&#x7CFB;&#xFF0C;&#x81EA;&#x589E;&#x957F;&#x751F;&#x6210;&#x3002;</strong>d&#x7ED3;&#x6784;&#xFF1A;</p>
<pre class="language-"><code class="lang-js"><span class="token comment">// &#x4E00;&#x4E2A;&#x57FA;&#x672C;&#x7684;&#x7ED3;&#x6784;&#x3002;&#x6CE8;&#xFF1A;v0.55&#xFF0C;&#x4E4B;&#x524D;&#x7684;&#x7248;&#x672C;define&#x53EF;&#x80FD;&#x4E0D;&#x540C;</span>
<span class="token function">__d</span><span class="token punctuation">(</span>
    <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">e<span class="token punctuation">,</span>r<span class="token punctuation">,</span>a<span class="token punctuation">,</span>i<span class="token punctuation">,</span>l</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
        <span class="token keyword">var</span> n<span class="token operator">=</span><span class="token function">r</span><span class="token punctuation">(</span>l<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        babelHelpers<span class="token punctuation">.</span><span class="token function">interopRequireDefault</span><span class="token punctuation">(</span>n<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">r</span><span class="token punctuation">(</span>l<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token number">11</span><span class="token punctuation">,</span><span class="token comment">//&#x6A21;&#x5757; id</span>
    <span class="token punctuation">[</span><span class="token number">12</span><span class="token punctuation">,</span><span class="token number">17</span><span class="token punctuation">]</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// define</span>
        <span class="token function">__d</span><span class="token punctuation">(</span>
          <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">global<span class="token punctuation">,</span> <span class="token operator">...</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">(</span>module transformed code<span class="token punctuation">)</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
          moduleId<span class="token punctuation">,</span>
          dependencyMap<span class="token operator">?</span><span class="token punctuation">,</span>
          moduleName<span class="token operator">?</span>
        <span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="&#x53C2;&#x8003;">&#x53C2;&#x8003;</h2>
<p><a href="https://blog.csdn.net/cz7260555/article/details/88392171" target="_blank">(RN) &#x62C6;(&#x5206;)&#x5305;&#x5B9E;&#x8DF5;-iOS</a></p>
<p><a href="https://www.codeleading.com/article/61262260962/" target="_blank">react-native&#x5B9E;&#x73B0;&#x4E0D;&#x91CD;&#x542F;App&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x66F4;&#x65B0;&#x5206;&#x5305;</a></p>
<p><a href="https://blog.csdn.net/tyro_smallnew/article/details/83660345" target="_blank">React native&#x62C6;&#x5305;&#x4E4B; &#x539F;&#x751F;&#x52A0;&#x8F7D;&#x591A;bundle&#xFF08;iOS&amp;Android&#xFF09;</a></p>
<p><a href="https://blog.csdn.net/tyro_smallnew/article/details/83088216" target="_blank">React native&#x62C6;&#x5305;&#x7684;&#x6B63;&#x786E;&#x59FF;&#x52BF;&#x2014;&#x2014;&#x57FA;&#x4E8E;metro bundle</a></p>
<p><a href="https://myslide.cn/slides/3943" target="_blank">&#x8881; &#x806A; - &#x5168;&#x6C11;K&#x6B4C;React Native&#x5B9E;&#x8DF5;&#x4E0E;&#x4F18;&#x5316;</a></p>
<p><a href="https://segmentfault.com/a/1190000014585725" target="_blank">&#x540C;app&#x4E0B;&#x591A;&#x4E2A;react-native jsBundle&#x7684;&#x89E3;&#x51B3;&#x65B9;&#x6848;</a></p>
<p><a href="https://blog.csdn.net/l2show/article/details/72859653" target="_blank">React Native Application&#x548C;Activity&#x6E90;&#x7801;&#x5206;&#x6790;</a></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="./" class="navigation navigation-prev navigation-unique" aria-label="Previous page: ReactNative">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"RN分包机制","level":"1.8.1","depth":2,"previous":{"title":"ReactNative","level":"1.8","depth":1,"path":"ReactNative/README.md","ref":"ReactNative/README.md","articles":[{"title":"RN分包机制","level":"1.8.1","depth":2,"path":"ReactNative/RN分包机制.md","ref":"ReactNative/RN分包机制.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["github","donate","splitter","-anchor-navigation-ex","-sharing","sharing-plus","-highlight","prism","toggle-chapters","-lunr","-search","search-plus"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{"css":["prismjs/themes/prism.css"]},"github":{"url":"https://github.com/MarioGogogo"},"splitter":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"donate":{"alipay":"","alipayText":"支付宝打赏","button":"赏","title":"","wechat":"http://7q5c2h.com1.z0.glb.clouddn.com/wechatpay.JPG","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"serif","size":2},"anchor-navigation-ex":{"associatedWithSummary":false,"showLevel":true,"multipleH1":true,"mode":"float","pageTop":{"showLevelIcon":false,"level1Icon":"fa fa-hand-o-right","level2Icon":"fa fa-hand-o-right","level3Icon":"fa fa-hand-o-right"}},"sharing":{"qq":false,"all":["weibo","qq","qzone","google","douban"],"douban":false,"facebook":false,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"toggle-chapters":{},"search-plus":{}},"theme":"default","author":"WuXiaolong","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"👨🏽‍💻前端漫游指南","language":"zh-hans","links":{"sidebar":{}},"gitbook":"3.2.3","description":"http://h5web.cc/"},"file":{"path":"ReactNative/RN分包机制.md","mtime":"2020-04-17T09:01:19.708Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-22T01:16:46.955Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

